<template>
  <a-modal
    :visible="visible"
    title="培养计划详细信息"
    cancelText="关闭"
    style="top: 20px;"
    :width="1200"
    @cancel="() => { $emit('cancel') }"
    >
    <detail-list :col="2">
      <detail-list-item term="姓名">{{ planInfo.pyjh.xm }}&emsp;</detail-list-item>
      <detail-list-item term="学号">{{ planInfo.pyjh.xh }}&emsp;</detail-list-item>
      <detail-list-item term="培养单位">{{ planInfo.pyjh.dwmc }}&emsp;</detail-list-item>
      <detail-list-item term="专业">{{ planInfo.pyjh.zymc }}&emsp;</detail-list-item>
      <detail-list-item term="年级">{{ planInfo.pyjh.sznj }}&emsp;</detail-list-item>
      <detail-list-item term="培养方案">{{ planInfo.pyjh.pyfamc }}&emsp;</detail-list-item>
    </detail-list>
    <credit-table :pyfa="planInfo.pyfa" :pyjh="planInfo.pyjh" :countErr="countErr"/>
    <a-table
      rowKey="id"
      :columns="columns"
      :dataSource="planInfo.pyjhkcList"
      :pagination="false"
      :scroll="{ x: 1200 }">
      <span slot="serial" slot-scope="text, record, index">
        {{ index + 1 }}
      </span>
    </a-table>
    <a-button slot="footer" type="primary" @click="() => { $emit('cancel') }">关闭</a-button>
  </a-modal>
</template>

<script>
import {message} from 'ant-design-vue'
import DetailList from '~/tool/DetailList'
import creditTable from '../components/creditTable.vue'
const DetailListItem = DetailList.Item

export default {
  props: ['visible'],
  data () {
    return {
      countErr: -1,
      planInfo: {
        pyfa: {},
        pyjh: {},
        pyjhkcList: []
      },
      columns: [
        {
          title: '序号',
          scopedSlots: { customRender: 'serial' }
        },
        {
          title: '课程代码',
          dataIndex: 'kcdm'
        },
        {
          title: '课程名称',
          dataIndex: 'kcmc'
        },
        {
          title: '学时',
          dataIndex: 'xs'
        },
        {
          title: '学分',
          dataIndex: 'xf'
        },
        {
          title: '修课要求',
          dataIndex: 'bxhxxmc'
        },
        {
          title: '课程类型',
          dataIndex: 'kclxmc'
        },
        {
          title: '是否学位课',
          dataIndex: 'sfxwkmc'
        },
        {
          title: '审核状态',
          dataIndex: 'kcshztmc'
        },
        {
          title: '审核意见',
          dataIndex: 'shyj'
        }
      ]
    }
  },
  components: {
    DetailList,
    DetailListItem,
    creditTable
  },
  methods: {
    getInfo (id) {
      message.loading('数据加载中...', 0)
      this.$api.cultivate.planDetail(id).then(res => {
        this.planInfo = res.data
        message.destroy()
      })
    },
    handleChange (e, kc) {
      kc.sfmbkc = e ? 1 : 0
    }
  }
}
</script>

<style>
</style>
